data.cor <- cor(county.Demo_and_Covid.allcounties[,-1], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
data.cor2 <- cor(county.Demo_and_Covid.500counties[,-c(1:2)], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor2, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
corrplot.mixed(data.cor2[7:13,c(1:5, 14:42,6)], upper = 'ellipse', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)", data = county.Demo_and_Covid.500counties)
## Warning: Some predictor variables are on very different scales: consider
## rescaling
## Warning: Some predictor variables are on very different scales: consider
## rescaling
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -1136.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.7838 -0.3381 -0.0799 0.1946 5.7385
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.0000007025 0.0008381
## Residual 0.0000128022 0.0035780
## Number of obs: 169, groups: stateID, 32
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -0.0078834524 0.0091117091 62.9937978090
## Affluence 0.0044273771 0.0010548742 89.8915250462
## Singletons.in.Tract 0.0016756747 0.0009199923 130.1898431447
## Seniors.in.Tract 0.0009573458 0.0011968482 141.0275922385
## African.Americans.in.Tract 0.0001892384 0.0010033390 142.8234576507
## Noncitizens.in.Tract 0.0008252479 0.0007412363 114.4679044712
## High.BP 0.0002290670 0.0001834995 84.9283261346
## Binge.Drinking 0.0001342278 0.0001471676 34.0140216879
## Cancer -0.0008074457 0.0010558317 82.9404698028
## Asthma 0.0004799810 0.0005131528 31.6148543958
## Heart.Disease 0.0006228789 0.0012304569 60.2513164164
## COPD 0.0000114929 0.0010388888 63.7611319806
## Smoking -0.0001376212 0.0002196774 67.7217850678
## Diabetes -0.0004584243 0.0005193751 64.7329511547
## No.Physical.Activity 0.0000023663 0.0001960089 74.2642571562
## Obesity 0.0001982331 0.0001686597 78.2031386556
## Poor.Sleeping.Habits -0.0000034336 0.0001626057 116.3049103396
## Poor.Mental.Health -0.0000195159 0.0003872136 26.1416586492
## Testing_Rate 0.0000005056 0.0000003146 28.4167113763
## Hospitalization_Rate -0.0001238669 0.0000840245 24.1970262355
## t value Pr(>|t|)
## (Intercept) -0.865 0.3902
## Affluence 4.197 0.0000634 ***
## Singletons.in.Tract 1.821 0.0708 .
## Seniors.in.Tract 0.800 0.4251
## African.Americans.in.Tract 0.189 0.8507
## Noncitizens.in.Tract 1.113 0.2679
## High.BP 1.248 0.2153
## Binge.Drinking 0.912 0.3681
## Cancer -0.765 0.4466
## Asthma 0.935 0.3567
## Heart.Disease 0.506 0.6146
## COPD 0.011 0.9912
## Smoking -0.626 0.5331
## Diabetes -0.883 0.3807
## No.Physical.Activity 0.012 0.9904
## Obesity 1.175 0.2434
## Poor.Sleeping.Habits -0.021 0.9832
## Poor.Mental.Health -0.050 0.9602
## Testing_Rate 1.607 0.1190
## Hospitalization_Rate -1.474 0.1533
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence 0.157
## Sngltns.n.T -0.005 0.049
## Snrs.n.Trct 0.591 0.378 0.172
## Afrcn.Am..T 0.191 0.160 -0.435 0.168
## Nnctzns.n.T -0.010 0.094 0.048 0.060 -0.075
## High.BP 0.019 0.245 0.094 0.134 -0.110 0.397
## Bing.Drnkng -0.240 -0.181 -0.302 -0.168 0.115 0.054 0.145
## Cancer -0.596 -0.213 0.180 -0.344 -0.078 -0.156 -0.400 -0.135
## Asthma -0.354 -0.212 -0.205 -0.160 0.080 0.089 0.169 -0.019 0.037
## Heart.Dises -0.147 0.078 -0.284 -0.150 0.237 -0.097 -0.032 0.062 -0.460
## COPD 0.552 0.037 0.132 0.270 0.007 0.289 0.215 0.126 -0.266
## Smoking -0.192 0.104 -0.179 -0.133 -0.087 -0.009 -0.107 -0.298 0.087
## Diabetes 0.057 -0.308 -0.159 -0.233 -0.274 -0.327 -0.525 0.040 0.222
## N.Physcl.Ac -0.176 -0.069 0.100 -0.028 -0.030 -0.229 -0.121 0.082 0.494
## Obesity 0.030 0.439 0.393 0.309 0.164 0.215 -0.069 -0.218 0.103
## Pr.Slpng.Hb -0.501 -0.415 0.180 -0.393 -0.407 0.007 -0.185 0.061 0.175
## Pr.Mntl.Hlt -0.316 0.262 -0.052 -0.060 0.111 -0.202 -0.097 0.040 0.310
## Testing_Rat 0.188 -0.092 -0.082 -0.011 0.057 -0.100 -0.015 0.033 -0.189
## Hsptlztn_Rt -0.139 -0.219 -0.161 -0.271 -0.071 -0.129 -0.133 -0.166 0.060
## Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A Obesty Pr.S.H Pr.M.H
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises 0.275
## COPD -0.364 -0.565
## Smoking 0.072 0.220 -0.527
## Diabetes -0.123 -0.236 -0.162 0.291
## N.Physcl.Ac 0.012 -0.396 0.002 -0.349 -0.087
## Obesity -0.288 -0.109 0.190 -0.219 -0.400 -0.059
## Pr.Slpng.Hb 0.084 0.244 -0.218 0.043 -0.017 -0.099 -0.175
## Pr.Mntl.Hlt -0.222 0.094 -0.458 0.079 0.036 0.079 0.093 -0.193
## Testing_Rat -0.359 -0.022 0.181 0.183 0.150 -0.333 0.074 -0.138 -0.122
## Hsptlztn_Rt 0.046 0.077 -0.107 0.152 0.118 -0.047 -0.134 0.023 -0.039
## Tstn_R
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises
## COPD
## Smoking
## Diabetes
## N.Physcl.Ac
## Obesity
## Pr.Slpng.Hb
## Pr.Mntl.Hlt
## Testing_Rat
## Hsptlztn_Rt 0.270
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling
testing.data.state <- compiled.stats[[length(daily_filenames)]][, c("Province_State", "Testing_Rate")]
testing.data.state <- testing.data.state[!is.na(testing.data.state$Testing_Rate),]
testing.data.state <- testing.data.state[order(testing.data.state$Testing_Rate),]
col.state <- rep("pink", nrow(testing.data.state))
avg.test.rate <- mean(testing.data.state$Testing_Rate, na.rm = T)
col.state[testing.data.state$Testing_Rate < avg.test.rate] <- "grey"
col.state[testing.data.state$Province_State == "Oklahoma"] <- "lightblue"
par(mar = c(5,6,4,2))
barplot(testing.data.state$Testing_Rate, names.arg = testing.data.state$Province_State, horiz = T, main = "Testing Rate by State", las = 2, cex.axis = 1, cex.names = 0.5, col = col.state, border = F, xlab = "Total number of people tested per 100,000 persons.")
abline(v = avg.test.rate, col = "red")
text(x = avg.test.rate + 10, y = 1, labels = "Average Testing Rate", adj = c(0, 0.5), col = "red")
day.first.case <- min(which(US.total$cases.total > 100))
n.days <- nrow(US.total)
par(mar = c(5,5,4,2))
barplot(US.total$cases.total[day.first.case:n.days], main = "Total COVID-19 cases by Date in US", las = 2, cex.axis = 1, cex.names = 0.5)
barplot(US.total$cases.total[day.first.case:n.days], main = "Total COVID-19 cases by Date in US, log scale", las = 2, cex.axis = 1, cex.names = 0.5, log = "y")
barplot(US.total$deaths.total[day.first.case:n.days], main = "Total COVID-19 deaths by Date in US", las = 2, cex.axis = 1, cex.names = 0.5)
barplot(US.total$deaths.total[day.first.case:n.days], main = "Total COVID-19 deaths by Date in US, log scale", las = 2, cex.axis = 1, cex.names = 0.5, log = "y")
barplot(US.total$rise.cases.total[day.first.case:n.days], main = "Rise in Cases of COVID-19 by Date in US", las = 2, cex.axis = 1, cex.names = 0.5)
barplot(US.total$rise.deaths.total[day.first.case:n.days], main = "Rise in Deaths of COVID-19 by Date in US", las = 2, cex.axis = 1, cex.names = 0.5)